<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // let str = 'wfhug fjg skdfff';
        // let arr = ['f','d','c']
        // // let num = str.indexOf('f');
        // let num = 0;
        // let target = str.indexOf('f');
        // while(target !== -1){
        //     num++;
        //     target = str.indexOf('f',target + 1)
        // }
        // console.log(num);

        // let arr = [1,2,3,4];
        // let newArr = arr.map(i => i*2);
        // console.log(newArr);

        // let arr = [1, 2, 3, 4, 5,6]
        // console.log(arr.pop());
        // console.log(arr.unshift(0));
        // console.log(arr.pop());
        // console.log(arr) //[1, 2, 3, 4]
        let arr = [1,2,3,4,5];
        let num = 0
        for(var i = 0; i < arr.length; i++){
            if(arr[i] == 5){
                // break
            } else {
                num++
            }
        }
        console.log(i);
        console.log(num);
        console.log(arr.length);


    </script>
</body>

</html>